// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

TestCase := Rectangle {
    property<float> p1: 100%;
    property<float> p2: 1%;
    property<float> p3: 5.5%;
    property<float> p4: 10 + 50%;

    property <percent> p_min: min(50%, 100%);
    property <percent> p_max: max(50%, 0%);
    property <percent> p_clamp: clamp(50%, 0%, 100%);

    property <bool> test: p_min == 50% && p_max == 50% && p_clamp == 50%;
}


/*

```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
auto fuzzy_compare = [](float a, float b) { return std::abs(a - b) < 0.00000001; };
assert(fuzzy_compare(instance.get_p1(), 1.));
assert(fuzzy_compare(instance.get_p2(), 0.01));
assert(fuzzy_compare(instance.get_p3(), 0.055));
assert(fuzzy_compare(instance.get_p4(), 10.5));
// self_test
assert(!fuzzy_compare(instance.get_p1(), 1.001));

assert(instance.get_test());
```

```rust
let instance = TestCase::new().unwrap();
assert_eq!(instance.get_p1(), 1.);
assert_eq!(instance.get_p2(), 0.01);
assert_eq!(instance.get_p3(), 0.055);
assert_eq!(instance.get_p4(), 10.5);

assert_ne!(instance.get_p3(), 0.0549);

assert!(instance.get_test());
```

```js
var instance = new slint.TestCase({});
function n(a) { return Math.round(a*1000000) }
assert.equal(n(instance.p1), n(1.));
assert.equal(n(instance.p2), n(0.01));
assert.equal(n(instance.p3), n(0.055));
assert.equal(n(instance.p4), n(10.5));
// self_test
assert.notEqual(n(instance.p1), n(1.001));

assert(instance.test);

```

*/
